#include "list.h"

int main()
{
    nodeptr cache = create_list();
    char url[30], ip[30];

    int opt = 1;
    int num = 0;
    while (opt)
    {
        printf("option input: 0.exit 1.push_front 2.get_ip 3.print_list\n");
        scanf("%d", &opt);

        switch (opt)
        {
        case 0:
            goto exit;

        case 1:
            printf("> push_front:\n");
            scanf("%s %s", url, ip);
            cache = push_front(cache, url, ip);
            break;

        case 2:
            printf("> get_ip:\n");
            scanf("%s", url);
            printf("%s\n", get_ip(cache, url));
            break;

        case 3:
            printf("> print_list:\n");
            print_list(cache);
            break;
        }
        num++;
    }
exit:
    delete_list(cache);
    return 0;
}